package cn.gok.service.impl;

import cn.gok.entity.User;
import cn.gok.mapper.UserMapper;
import cn.gok.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired(required = false)
    private UserMapper userMapper;
    @Override
    public int add(Map<String, Object> map) {
        //这里判断一下账后是否已经存在
        if (userMapper.zhuce((String) map.get("userName")).size()==0){
            return userMapper.add(map);
        }
        return 0;
    }
    @Override
    public int updata(Map<String, Object> map) {
        return userMapper.updata(map);
    }
    @Override
    public int del(Map<String, Object> map) {
        return userMapper.del(map);
    }
    @Override
    public List<User> sel(Map<String, Object> map) {
        return userMapper.sel(map);
    }
    @Override
    public List<User> show(Map<String, Object> map) {
        return userMapper.show(map);
    }
    @Override
    public int re(Map<String, Object> map) {
        return userMapper.re(map);
    }
    @Override
    public List<User> details(Map<String, Object> map) {
        return userMapper.details(map);
    }
}
